<script>
init({
  title: 'Custom Search',
  desc: 'Use `customSearch` option to custom search function is executed instead of built-in search function. In this case, we only search the price column.',
  links: ['bootstrap-table.min.css'],
  scripts: ['bootstrap-table.min.js']
})
</script>

<template>
  <table
    id="table"
    data-search="true"
    data-custom-search="customSearch"
    data-url="json/data1.json"
  >
    <thead>
      <tr>
        <th data-field="id">
          ID
        </th>
        <th data-field="name">
          Item Name
        </th>
        <th data-field="price">
          Item Price
        </th>
      </tr>
    </thead>
  </table>
</template>

<script>
  function mounted () {
    $('#table').bootstrapTable({
      formatSearch () {
        return 'Search Item Price'
      }
    })
  }

  window.customSearch = (data, text) => data.filter(function (row) {
    return row.price.indexOf(text) > -1
  })
</script>
